# Maintainer: Massimiliano Torromeo <massimiliano.torromeo@gmail.com>
# Contributor: Blisfull <narthana.epa@gmail.com>
# Contributor: SahibBommelig <sahib@online.de>

pkgbase=rmlint
pkgname=(rmlint rmlint-shredder)
pkgver=2.10.1
pkgrel=4
url="https://github.com/sahib/rmlint"
license=('GPL3')
arch=('loong64' 'x86_64')
makedepends=('scons' 'python-sphinx' 'gettext' 'sqlite' 'util-linux-libs'
             'binutils' 'json-glib' 'libelf' 'python-gobject' 'python-cairo'
             'dconf' 'gtksourceview3' 'librsvg' 'desktop-file-utils' 'python-requests')
source=("https://github.com/sahib/rmlint/archive/v$pkgver/$pkgbase-$pkgver.tar.gz")
sha256sums=('10e72ba4dd9672d1b6519c0c94eae647c5069c7d11f1409a46e7011dd0c6b883')

build() {
    cd "$srcdir"/$pkgbase-$pkgver
    scons config
    scons -j4 DEBUG=1 --prefix="$pkgdir"/usr --actual-prefix=/usr
}

package_rmlint() {
    pkgdesc="Tool to remove duplicates and other lint, being much faster than fdupes"
    depends=('sqlite' 'util-linux-libs' 'binutils' 'json-glib' 'libelf')

    cd "$srcdir"/$pkgbase-$pkgver
    scons DEBUG=1 --prefix="$pkgdir"/usr install --actual-prefix=/usr

    rm -rf "$pkgdir"/usr/share/{glib-2.0,icons,applications}
    rm -rf "$pkgdir"/usr/lib
}

package_rmlint-shredder() {
    pkgdesc="Graphical user interface for rmlint"
    depends=('rmlint' 'python-gobject' 'python-cairo' 'dconf' 'librsvg'
             'gtksourceview3' 'xdg-utils')

    cd "$srcdir"/$pkgbase-$pkgver
    scons DEBUG=1 --prefix="$pkgdir"/usr install --actual-prefix=/usr

    rm -rf "$pkgdir"/usr/{bin,share/locale,share/man}
    rm "$pkgdir"/usr/share/glib-2.0/schemas/gschemas.compiled
}
